{{- range $key, $value := .CandiVersionMap.k8s }}
  {{- $version := toString $key }}
  {{- if $value.ccm.yandex }}
---
image: {{ $.ModuleName }}/{{ $.ImageName }}-{{ $version | replace "." "-" }}
fromImage: common/distroless
import:
- artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact-{{ $version | replace "." "-" }}
  add: /src/yandex-cloud-controller-manager
  to: /usr/local/bin/cloud-controller-manager
  before: setup
docker:
  ENTRYPOINT: ["/usr/local/bin/cloud-controller-manager"]
---
artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact-{{ $version | replace "." "-" }}
    {{- if semverCompare ">=1.29" $version }}
from: {{ $.Images.BASE_GOLANG_21_ALPINE_DEV }}
    {{- else if semverCompare ">=1.27" $version }}
from: {{ $.Images.BASE_GOLANG_20_ALPINE_DEV }}
    {{- else if semverCompare ">=1.25" $version }}
from: {{ $.Images.BASE_GOLANG_19_ALPINE_DEV }}
    {{- end }}
git:
- add: /{{ $.ModulePath }}modules/030-{{ $.ModuleName }}/images/{{ $.ImageName }}/patches
  to: /patches
  stageDependencies:
    install:
    - '**/*'
mount:
- fromPath: ~/go-pkg-cache
  to: /go/pkg
shell:
  install:
    - git clone --depth 1 --branch {{ $value.ccm.yandex }} https://github.com/deckhouse/yandex-cloud-controller-manager.git /src
    - cd /src
    - git apply /patches/{{ $version }}/*.patch
    - export GOPROXY={{ $.GOPROXY }}
    - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o yandex-cloud-controller-manager cmd/yandex-cloud-controller-manager/main.go
    - chown 64535:64535 /src/yandex-cloud-controller-manager
    - chmod 0755 /src/yandex-cloud-controller-manager
  {{- end }}
{{- end }}
